<template>
  <div class="app-container">
    <el-row>
      <el-col :span="24">
        <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="85px" style="margin-left:-35px"
          v-if="enterpriseId ===null" >
          <el-form-item label="姓名" prop="name">
            <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery"
              width="150px" />
          </el-form-item>
<!--          <el-form-item label="职务" prop="position">-->
<!--            <el-input v-model="queryParams.position" placeholder="请输入职位" clearable @keyup.enter.native="handleQuery"-->
<!--              width="150px" />-->
<!--          </el-form-item>-->
          <el-form-item label="标签" prop="labelPerson">
            <el-select v-model="queryParams.labelPerson" placeholder="请选择标签" style="width:150px">
              <el-option
                v-for="dict in dict.type.label_person"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              ></el-option>
            </el-select >
          </el-form-item>
          <el-form-item label="企业名称" prop="enterpriseName" v-if="enterpriseId === null">
            <el-input v-model="queryParams.enterpriseName" placeholder="请输入企业名称" clearable
              @keyup.enter.native="handleQuery" />
          </el-form-item>
          <<el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button  type="primary" plain icon="el-icon-plus" size="mini"
                       @click="handleAdd" v-if="opt!=='details'">新增</el-button>
          </el-col>
        </el-row>
        <div style="width: 100%;height: 90vh;overflow:auto; margin-bottom: 30%;padding-bottom: 18%;position: relative;">
        <el-table :row-style="{ height: '30px' }" :cell-style="{ padding: '0px' }" :height="500" border
                  :header-cell-style="{'text-align':'center'}"   v-loading="loading" :data="personList" @selection-change="handleSelectionChange" highlight-current-row>
          <el-table-column type="selection" width="40" align="center" v-if="showClose === false" />
          <el-table-column label="序" type="index" :index="indexMethod" width="35"/>
          <el-table-column label="建档时间" align="center" prop="filingTime" :width="85">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.filingTime, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="建档人" align="center" prop="userName" :show-overflow-tooltip="true" width="70" />
          <el-table-column label="姓名" align="center" prop="name" :show-overflow-tooltip="true" width="60"/>
            <!--            <template slot-scope="scope">-->
            <!--              <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />-->
            <!--            </template>-->
            <!--          </el-table-column>-->
<!--          <el-table-column label="职位" align="center" prop="position" :show-overflow-tooltip="true" />-->
<!--          <el-table-column label="主管范围" align="center" prop="supervisorScope" :show-overflow-tooltip="true">-->
<!--            <template slot-scope="scope">-->
<!--              <div class="supervisorScope" :title="scope.row.supervisorScope">{{ scope.row.supervisorScope }}</div>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column label="联系方式" align="center" prop="phone" :show-overflow-tooltip="true" width="110"/>
          <el-table-column label="性别" align="center" prop="sex" :show-overflow-tooltip="true" width="60" >
            <template slot-scope="scope">
              <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
            </template>
          </el-table-column>
          <el-table-column label="从业企业" align="left" prop="enterpriseName" :show-overflow-tooltip="true" width="195"/>
          <el-table-column label="职务" align="center" prop="position" :show-overflow-tooltip="true" width="60"/>
<!--          <el-table-column label="学历" align="center" prop="education" :show-overflow-tooltip="true" />-->
<!--          <el-table-column label="籍贯" align="center" prop="nativePlace" :show-overflow-tooltip="true" />-->
<!--          <el-table-column label="出生日期" align="center" prop="birthday" :width="100" :show-overflow-tooltip="true">-->
<!--            <template slot-scope="scope">-->
<!--              <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column label="入职时间" align="center" prop="entryTime" :width="100" :show-overflow-tooltip="true">-->
<!--            <template slot-scope="scope">-->
<!--              <span>{{ parseTime(scope.row.entryTime, '{y}-{m}-{d}') }}</span>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column label="状态" align="center" prop="status"  width="50">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.enter_person" :value="scope.row.status" />
            </template>
          </el-table-column>
                    <el-table-column label="最新联系时间" align="center" prop="contactTime" :width="100" :show-overflow-tooltip="true">
                      <template slot-scope="scope">
                        <span>{{ parseTime(scope.row.contactTime, '{y}-{m}-{d}') }}</span>
                      </template>
                    </el-table-column>
          <el-table-column label="最新联系内容" align="center" prop="contactContent" :width="100" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.contactContent, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>
          <el-table-column label="参训次数" align="center" prop="activityCount" :show-overflow-tooltip="true" width="70"/>
          <el-table-column label="标签" align="center" prop="labelPerson"  >
            <template slot-scope="scope">
              <dict-tag :options="dict.type.contact_tag" :value="scope.row.labelPerson" />
            </template>
          </el-table-column>
<!--          <el-table-column label="附件" align="center" prop="uploadFile">-->
<!--            <template slot-scope="scope">-->
<!--              <el-button v-if="scope.row.fileUrl != null && scope.row.fileUrl != ''"-->
<!--                @click.stop="handlePictureCardPreview(scope.row.uploadFile)" size="small" type="text">附件</el-button>-->
<!--              <el-button size="small" v-else type="text">无附件</el-button>-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column label="创建时间" align="center" prop="creationTime" :width="100" :show-overflow-tooltip="true">-->
<!--            <template slot-scope="scope">-->
<!--              <span>{{ parseTime(scope.row.creationTime, '{y}-{m}-{d}') }}</span>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right"
            v-if="showClose === false && opt !== 'details'" width="86px">
            <template slot-scope="scope">
              <table-operation-buttons
                :has-edit="true"
                :has-delete="true"
                edit-text="编辑人员信息"
                delete-text="删除人员信息"
                @edit="handleUpdate(scope.row, scope.$index)"
                @delete="handleDelete(scope.row)"
              />
            </template>
          </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize" @pagination="getList" />
        </div>
      </el-col>
    </el-row>
    <!-- 添加或修改企业人员管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body @close="personClose">
      <el-tabs v-model="activeName" type="card">
        <!--        新增人员-->
        <el-tab-pane label="基本信息" name="first">
          <el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true">
            <div v-if="addSign === 1">
              <el-descriptions title="">
                <el-descriptions-item label="序号">
                  <el-tag size="medium">{{ form.index }}</el-tag>
                </el-descriptions-item>
              </el-descriptions>
            </div>
            <el-row>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="现任企业" prop="enterpriseName" label-width="110px">
                  <el-input v-model="form.enterpriseName" placeholder="请选择企业名称" @focus="enterprise"
                    :disabled="isOnlyEnter" />
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="姓名" prop="name" label-width="110px">
                  <el-input v-model="form.name" placeholder="请输入姓名" :disabled="ReadOnly" maxlength="10"
                    show-word-limit />
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="创建时间" prop="creationTime" label-width="110px">
                  <el-date-picker clearable v-model="form.creationTime" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择创建时间" style="width: 186px" disabled="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="用户性别" prop="sex" label-width="110px">
                  <el-select v-model="form.sex" placeholder="请选择性别" style="width: 186px" :disabled="ReadOnly">
                    <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
                      :value="dict.value"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="电话" prop="phone" label-width="110px">
                  <el-input v-model="form.phone" placeholder="请输入电话" :disabled="ReadOnly" />
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="技术职称" prop="title" label-width="110px">
                  <el-input v-model="form.title" placeholder="请输入技术职称" :disabled="ReadOnly" maxlength="20"
                    show-word-limit />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="职务" prop="position" label-width="110px">
                  <el-input v-model="form.position" placeholder="请输入职务" :disabled="ReadOnly" maxlength="20"
                    show-word-limit />
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="主管范围" prop="supervisorScope" label-width="110px">
                  <el-input v-model="form.supervisorScope" placeholder="请输入主管范围" :disabled="ReadOnly" maxlength="20"
                    show-word-limit />
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="学历" prop="education" label-width="110px">
                  <el-input v-model="form.education" placeholder="请输入学历" :disabled="ReadOnly" maxlength="10"
                    show-word-limit />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="籍贯" prop="nativePlace" label-width="110px">
                  <el-input v-model="form.nativePlace" placeholder="请输入籍贯" :disabled="ReadOnly" maxlength="10"
                    show-word-limit />
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="建档时间" prop="filingTime" label-width="110px">
                  <el-date-picker clearable v-model="form.filingTime" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择建档时间" style="width: 186px" disabled="true">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="出生日期" prop="birthday" label-width="110px">
                  <el-date-picker clearable v-model="form.birthday" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择出生日期" style="width: 186px" :disabled="ReadOnly">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="入职时间" prop="entryTime" label-width="110px">
                  <el-date-picker clearable v-model="form.entryTime" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择入职时间" style="width: 186px" :disabled="ReadOnly">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="状态" prop="status" label-width="110px">
                  <el-select v-model="form.status" placeholder="请选择状态" style="width: 186px" :disabled="ReadOnly">
                    <el-option v-for="dict in dict.type.enter_person" :key="dict.value" :label="dict.label"
                      :value="dict.value"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="创建人" prop="createId" label-width="110px">
                  <el-input v-model="form.userName" placeholder="请输入创建人" disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" style="height: 55px;">
                <el-form-item label="标签" prop="createId" label-width="110px">
                  <el-select v-model="form.labelPerson" placeholder="请选择标签" style="width: 186px" :disabled="ReadOnly">
                    <el-option v-for="dict in dict.type.contact_tag" :key="dict.value" :label="dict.label"
                               :value="dict.value"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="16" style="height: 118px;">
                <el-form-item label="附件" prop="uploadFile" label-width="110px">
                  <file-view v-if="show" :limit="1" :type="typeSelect" :businessId="form.uploadFile"
                    :businessCode="businessCode"></file-view>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="其他信息" name="other" >
        </el-tab-pane>
        <!--        新增人员结束-->
        <!-- 关联合同-->
        <el-tab-pane label="关联合同" name="second" v-if="open && typeSelect !== 0">
          <contract :enterprise-name="form.enterpriseName" :telephone="form.phone"></contract>
        </el-tab-pane>
        <!--        关联合同结束-->
        <!--        客户管理更近记录开始-->
        <el-tab-pane label="跟进记录" name="third" v-if="open && typeSelect !== 0">
          <person-records :enterprise-id="form.id"></person-records>
        </el-tab-pane>
<!--        活动培训-->
        <el-tab-pane label="培训活动" name="activity" v-if="open && typeSelect !== 0">
        </el-tab-pane>
        <!--        客户管理更进记录结束-->
      </el-tabs>
      <div slot="footer" class="dialog-footer centered-footer">
        <el-button type="primary" @click="submitForm()" v-if="addSign !== 2 && activeName === 'first'">确 定</el-button>
        <el-button @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>
    <!--   履历 附件展示对话框-->
    <el-dialog title="查看附件" :visible.sync="openFileList" width="500px" append-to-body v-if="openFileList">
      <UploadFile :upload-id="uploadId" :business-code="businessCode"></UploadFile>
    </el-dialog>
    <el-dialog title="选择企业" :visible.sync="openUser" width="800px" append-to-body>
      <change-enter v-if="openUser" @select-enterprise="handleSelectEnterprise" @select-seas="handleSelectSeas"
        @select-ele="handleSelectEle" @select-coll="handleSelectColl">
      </change-enter>
    </el-dialog>
  </div>
</template>

<script>
import { listPerson, getPerson, delPerson, addPerson, updatePerson } from "@/api/enterprise/person";
import { listType } from "@/api/maintype/type";
import BusinessInfo from "../info/index.vue";
import MainType from "@/components/MainType/index"
import FileView from "@/components/FileView/index"
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import UploadFile from "../../upload/index.vue";
import ChangeEnter from "./enterprise.vue";
import Contract from "./contract.vue";
import PersonRecords from "./records.vue";
import TableOperationButtons from "@/components/TableOperationButtons";

export default {
  components: { PersonRecords, Contract, ChangeEnter, UploadFile, Treeselect, BusinessInfo, FileView, MainType, TableOperationButtons },
  dicts: ['sys_normal_disable', 'sys_user_sex', 'enter_person','contact_tag'],
  name: "Person",
  props: {
    enterpriseId: {
      type: String,
      default: null
    },
    showClose: {
      type: Boolean,
      default: false
    },
    enterpriseName: {
      type: String,
      default: null
    },
    //提供给别的模块调用人员管理使用，企业管理现任企业选择，只能是当前企业
    isOnlyRead: {
      type: Boolean,
      default: false,
    },
    isOpen: {
      type: Boolean,
      default: false
    },
      isEnterprise: {
      type: Boolean,
      default: true,
    },
    showBtn: {
      type: Boolean,
      default: true
    },
    opt:{
      type:String,
      default:''
    }
  },
  data() {
    var checkPhone = (rule, value, callback) => { // 手机号验证
      if (!value) {
        return callback(new Error('手机号不能为空'));
      } else {
        const reg = /^1[3456789]\d{9}$/
        if (reg.test(value)) {
          callback();
        } else {
          return callback(new Error('请输入正确的手机号'));
        }
      }
    };
    return {
      //主分类
      typeCode: 'person',
      honorShow: 0,
      // 遮罩层
      loading: true,
      //只读
      readonly: false,
      // 选中数组
      ids: [],
      ImgDig: false,
      //图片的标志位
      show: false,
      isOnlyEnter: false,
      activeName: 'first',//tab页
      // 非单个禁用
      single: true,
      //附件对话框
      openFileList: false,
      uploadId: null,
      dialogImageUrl: null,
      // 非多个禁用
      multiple: true,
      openUser: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      typeSelect: 0,
      // 企业人员管理表格数据
      personList: [],
      //详情状态
      ReadOnly: false,

      // 弹出层标题
      title: "",
      businessCode: 'enterprise_person',
      // 是否显示弹出层
      open: false,
      //新增或编辑
      addSign: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 15,
        enterpriseId: null,
        name: null,
        position: null,
        enterpriseName: null,
        labelPerson:null
      },
      //主分类
      options: null,
      // 表单参数
      form: {
        enterpriseName: null,
      },
      // 表单校验
      rules: {
        enterpriseName: [
          { required: true, message: '企业不能为空' },
          {
            validator: (rule, value, callback) => {
              if (!value && this.form.enterpriseName) {
                callback(new Error('企业不能为空'));
              } else {
                callback();
              }
            },
            trigger: 'change'
          }
        ],
        name: [
          { required: true, message: '请输入姓名', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '请输入电话号码', trigger: 'blur' },
          { validator: checkPhone, trigger: 'blur' }
        ],
        sex: [
          { required: true, message: '请选择性别', trigger: 'change' },
        ],
      }
    };
  },
  created() {
    this.getList();
    this.listType();
  },
  methods: {
    /** 查询企业人员管理列表 */
    getList() {
      this.loading = true;
      this.queryParams.enterpriseId = this.enterpriseId;
      listPerson(this.queryParams).then(response => {
        this.personList = response.rows;
        console.log(this.personList)
        this.total = response.total;
        this.loading = false;
      });
    },
    //获取树节点数据
    listType() {
      listType({ typeCode: 'person' }).then(res => {
        console.log(res);
        this.options = res.data;
      })
    },
    //树点击事件
    getNode(data, node, obj) {
      console.log(data)
      if (data.parentId != '00000000-0000-0000-0000-000000000000') {
        this.queryParams.classificationId = data.id
      } else {
        this.queryParams.classificationId = null
      }
      this.getList()
    },
    // 取消按钮
    cancel() {
      this.show = false;
      this.open = false;
      this.typeSelect = 0;
      this.activeName = 'first';
      this.reset();
    },
    personClose() {
      this.cancel();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        enterpriseId: null,
        name: null,
        phone: null,
        position: null,
        sex: null,
        remark: null,
        operateId: null,
        departmentId: null,
        departmentName: null,
        organizationId: null,
        organizationName: null,
        creationTime: null,
        operateTime: null,
        delFlag: null,
        filingTime: null,
        supervisorScope: null,
        title: null,
        education: null,
        nativePlace: null,
        birthday: null,
        entryTime: null,
        createId: null,
        status: null,
        userName: null,
        fileUrl: null,
        enterpriseName: null,
        uploadFile: null,
        labelPerson: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.name = null;
      this.queryParams.education = null;
      this.queryParams.position = null;
      this.queryParams.enterpriseName = null;
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    enterprise() {
      this.openUser = true;
    },
    close() {
      this.openUser = false
    },
    selectEnterprise(data) {
      this.form.enterpriseId = data.enterpriseId
      this.form.enterpriseName = data.enterpriseName
      console.log(this.form)
      this.close()
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      console.log(this.typeSelect)
      this.listType();
      this.typeSelect = 0;
      this.ReadOnly = false;
      this.title = '新增联系人管理';
      this.form.creationTime = new Date();
      this.form.filingTime = new Date();
      this.form.userName = this.$store.state.user.name;
      if (this.enterpriseId !== null) {
        this.form.enterpriseName = this.enterpriseName;
        this.form.enterpriseId = this.enterpriseId;
        this.isOnlyEnter = true;
      } else {
        this.isOnlyEnter = false;
      }
      if (this.queryParams.classificationId === null) {
        this.form.classificationId = '650c44e1-b575-4b62-9d54-1ba9d1e8abb7'
      } else {
        this.form.classificationId = this.queryParams.classificationId;
      }
      this.ReadOnly = false;
      this.addSign = 0;
      this.form.uploadFile = new Date().getTime();
      this.show = true;
      this.open = true;
      this.title = "添加联系人管理";
    },
    //序号展示
    indexMethod(index) {
      return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1;
    },
    /** 修改按钮操作 */
    handleUpdate(row, index) {
      this.reset();
      this.listType();
      const id = row.id || this.ids
      getPerson(id).then(response => {
        this.listType();
        this.form = response.data;
        if (this.form.uploadFile == null) {
          this.form.uploadFile = new Date().getTime();
        }
        this.addSign = 1;
        this.form.index = index + 1;
        this.activeName = 'first';
        this.typeSelect = 1;
        this.isOnlyEnter = true;
        this.ReadOnly = false;
        this.show = true;
        this.open = true;
        this.title = "修改企业人员管理";
      });
    },
    //详情
    handleSelect(row, index) {
      this.reset();
      const id = row.id || this.ids
      getPerson(id).then(response => {
        this.form = response.data;
        this.form.index = index + 1;
        this.ReadOnly = true;
        this.isOnlyEnter = true;
        this.show = true;
        this.open = true;
        this.title = "详情";
        this.addSign = 2;
        this.typeSelect = 2;
      });
    },
    /** 提交按钮 */
    submitForm() {
      console.log(this.form)
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePerson(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.show = false;
              this.getList();
              this.reset();
              this.$emit('change');
            });
          } else {
            console.log(this.form)
            addPerson(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.show = false;
              this.getList();
              this.reset();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$modal.confirm('是否确认删除联系人管理名称为"' + row.name + '"的数据项？').then(function () {
        return delPerson(row.id);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    handlePictureCardPreview(id) {
      this.uploadId = id;
      this.openFileList = true;
    },
    handleSelectEnterprise(data) {
      // 处理企业选择
      this.form.enterpriseName = data.enterpriseName;
      this.form.enterpriseId = data.enterpriseId;
      this.openUser = false;
    },
    handleSelectSeas(data) {
      // 处理公海选择
      this.form.enterpriseName = data.enterpriseName;
      this.form.enterpriseId = data.enterpriseId;
      this.openUser = false;
    },
    handleSelectEle(data) {
      // 处理电销选择
      this.form.enterpriseName = data.enterpriseName;
      this.form.enterpriseId = data.electricId;
      this.openUser = false;
    },
    handleSelectColl(data) {
      // 处理电销选择
      console.log(data.enterpriseName)
      this.form.enterpriseName = data.enterpriseName;
      this.form.enterpriseId = data.collId;
      this.openUser = false;
    },
  }
};
</script>
<style scoped>
.dialog-footer.centered-footer {
  text-align: center;
  margin-top: -10px;
  /* Adjust this value as needed */
}
</style>
